Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non poissonian tests #205

Merged

Conversation

bayonato89
Copy link
Contributor

@bayonato89 bayonato89 commented Sep 28, 2022

pyCSEP Pull Request Checklist

Please check out the contributing guidelines for some tips
on making pull requests to pyCSEP.

Fixes issue #(please fill in or delete if not needed).

Type of change:

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (this pull request adds no new code)
  • Unpublished science feature (This may require a science review)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Comment on lines +108 to +115
if random_numbers is None:
random_numbers = numpy.random.rand(num_events)
else:
# TODO: ensure that random numbers are all between 0 and 1.
pass

# reset simulation array to zero, but don't reallocate
sim_fore.fill(0)
Copy link
Collaborator

@wsavran wsavran Oct 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bayonato89 @khawajasim can we remove this part of the function? the vector random_numbers is not used for anything it seems. the simulation below allocates a new array called random_num. i think we still need to keep the sim_fore.fill(0) should be included.

if (idx + 1) % 100 == 0:
print(f'... {idx + 1} catalogs simulated.')

target_idx = numpy.nonzero(catalog.ravel())
Copy link
Collaborator

@wsavran wsavran Oct 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line also doesn't work because the variable catalog is not defined anywhere here. should this be observed_data?

@wsavran
Copy link
Collaborator

wsavran commented Oct 3, 2022

thanks for this contribution. looks like we're getting really close. i left some comments on this pull request. we still need a test case here to verify that everything is working as we expect. @khawajasim @bayonato89 can you get some test cases for this module? we need to make sure that _simulate_catalogs and _binary_likelihood_test are tested. the TestPoissonLikelihood class in test_evaluations.py is a good template to follow.

@khawajasim
Copy link
Contributor

I think I can take care of unit tests for _binary_likelihood_test, _simulate_catalogs in the coming days.

random_num = numpy.random.uniform(0,1)
loc = numpy.searchsorted(sampling_weights, random_num)
if sim_fore[loc] == 0:
numpy.add.at(sim_fore, loc, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be indexed

@wsavran wsavran changed the base branch from master to v0.6.1-release-branch November 8, 2022 16:27
@wsavran wsavran merged commit 94dee18 into SCECcode:v0.6.1-release-branch Nov 14, 2022
wsavran added a commit that referenced this pull request Dec 12, 2022
* Quadtree csv reader (#186)
* New plotting routines (#190)
* Non poissonian tests (#189, #202, #205, #208, #209)
* Fix region border plot (#199)
* Added support for BSI catalog (#201)
* Fix consistency plots (#206)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants